package com.tool.mysql.springMysql.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tool.mysql.springMysql.entity.User;
import com.tool.mysql.springMysql.mapper.UserMapper;
import com.tool.mysql.springMysql.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 酒徒
 * @Version 1.0
 * @data 2024/1/22 18:10
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 获取用户信息
     * @return
     */
    @Override
    public User getUser() {
        LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<User>();
        wrapper.orderByDesc(User::getCreateTime);
        User user = userMapper.selectOne(wrapper);
        return user;
    }
}
